//
//  WGQAlbumDateHeaderView.m
//  meiang_edu
//
//  Created by gq w on 2018/10/2.
//  Copyright © 2018 com.meiang.meiang_edu. All rights reserved.
//

#import "WGQAlbumDateHeaderView.h"
#import "WGQAlbumDateHeaderViewCollectionViewCell.h"
#import "SKCalendarManage.h"

@interface WGQAlbumDateHeaderView ()<UICollectionViewDelegate,UICollectionViewDataSource>

@property (nonatomic,strong) UICollectionView * calendarCollectionView;
@property (nonatomic,strong) NSMutableArray * collectionArray;
@property (nonatomic,assign) NSInteger dayInWeek;
@property (nonatomic, strong) NSDate * theDate;// 当前日期
@property (nonatomic,strong) UILabel * dateLabel;//显示当前日期

@end

@implementation WGQAlbumDateHeaderView

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame])
    {
        self.collectionArray = [NSMutableArray array];
        [self takeHalfYearData];
        [self addSubViews];
        [self.calendarCollectionView scrollToItemAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:self.collectionArray.count - 1] atScrollPosition:UICollectionViewScrollPositionRight animated:NO];
    }
    return self;
}

- (void)takeHalfYearData
{
    NSMutableArray * muArray = [NSMutableArray arrayWithObjects:@{},@{},@{},@{},@{},@{},@{}, nil];
    SKCalendarManage * manage = [SKCalendarManage manage];
    [manage checkThisMonthRecordFromToday:[NSDate date]];
    //今天是几号
    NSString * todyNumber = [NSString stringWithFormat:@"%ld",(long)[manage.calendarDate[manage.todayPosition] integerValue]];
    
    NSInteger dayInWeek = (([todyNumber integerValue] - 1) % 7 + manage.dayInWeek) % 7;
    
    if (dayInWeek > 0)
    {
         dayInWeek = dayInWeek - 1;
    }
    else
    {
        //dayinweek = 0,说明是7 的整倍数，代表是周六，
        dayInWeek = 6;
    }
    
    self.dayInWeek = dayInWeek;
    //先把今天加进去
    [muArray replaceObjectAtIndex:self.dayInWeek withObject:@{@"time":[NSString stringWithFormat:@"%lu-%.2lu-%.2ld",(unsigned long)manage.year,(unsigned long)manage.month,(long)[manage.calendarDate[manage.todayPosition] integerValue]],
                                                         @"date":manage.chineseCalendarDay[manage.todayPosition]
                                                         }];
    NSInteger todayPosition = [[NSString stringWithFormat:@"%lu",(unsigned long)manage.todayPosition] integerValue] ;
    //获取本周今天之后的数据
    [manage checkThisMonthRecordFromToday:[NSDate date]];
    for (int i = (int)self.dayInWeek + 1; i < 7; i ++)
    {
        todayPosition ++;
        if (todayPosition > manage.calendarDate.count - 1)
        {
            //当前日期的位置超出当前月份，跨入到下个月
            NSUInteger todayInMonth = manage.todayInMonth;
            if (todayInMonth > 1)
            {
                todayInMonth = manage.todayInMonth - manage.dayInWeek + 2;
            }
            NSUInteger day = manage.days - todayInMonth;
            NSInteger hours = (day + 1) * 24;
            NSDate * date = [NSDate dateWithTimeInterval:hours * 60 * 60 sinceDate:[NSDate date]];
            [manage checkThisMonthRecordFromToday:date];
            for (int k = (int)[manage.calendarDate count] - 1; k > 0; k --)
            {
                id obj = manage.calendarDate[k];
                if ([obj isKindOfClass:[NSNumber class]])
                {
                    NSNumber * number = obj;
                    NSString * string = [NSString stringWithFormat:@"%lu-%.2lu-%.2ld",(unsigned long)manage.year,(unsigned long)manage.month,(long)[number integerValue]];
                    BOOL isHaveCalendarDateObj = NO;
                    for (int j = 0; j < muArray.count; j ++)
                    {
                        id collectionArrayObj = muArray[j];
                        if ([collectionArrayObj isKindOfClass:[NSDictionary class]])
                        {
                            NSDictionary * dict = collectionArrayObj;
                            NSString * collectionArrayTime = dict[@"time"];
                            if ([string isEqualToString:collectionArrayTime])
                            {
                                isHaveCalendarDateObj = YES;
                            }
                        }
                    }
                    if (isHaveCalendarDateObj == NO)
                    {
                        [muArray replaceObjectAtIndex:i withObject:@{@"time":[NSString stringWithFormat:@"%lu-%.2lu-%.2ld",(unsigned long)manage.year,(unsigned long)manage.month,(long)[number integerValue]],@"date":manage.chineseCalendarDay[k]
                                                                     }];
                        break;
                    }
                }
            }
        }
        else
        {
            //依旧是当前月
            [muArray replaceObjectAtIndex:i withObject:@{@"time":[NSString stringWithFormat:@"%lu-%.2lu-%.2ld",(unsigned long)manage.year,(unsigned long)manage.month,[manage.calendarDate[todayPosition] integerValue]],
                                                         @"date":manage.chineseCalendarDay[todayPosition]
                                                         }];
        }
    }
    
    //计算本周之前的数据,推半年
    [manage checkThisMonthRecordFromToday:[NSDate date]];

    NSInteger todayPosition1 = [[NSString stringWithFormat:@"%lu",(unsigned long)manage.todayPosition] integerValue] ;
    self.theDate = [NSDate date];
    for (int i = (int)self.dayInWeek-1; i > -1; i --)
    {
        todayPosition1 -- ;
        if (todayPosition1 < 0)
        {
            //跨入到上个月
            NSInteger hours = (manage.days - 1) * -24;
            NSDate * date = [NSDate dateWithTimeInterval:hours * 60 * 60 sinceDate:[NSDate date]];
            [manage checkThisMonthRecordFromToday:date];
            
            for (int k = (int)[manage.calendarDate count] - 1; k > 0; k --)
            {
                id obj = manage.calendarDate[k];
                if ([obj isKindOfClass:[NSNumber class]])
                {
                    NSNumber * number = obj;
                    NSString * string = [NSString stringWithFormat:@"%lu-%.2lu-%.2ld",(unsigned long)manage.year,(unsigned long)manage.month,(long)[number integerValue]];
                    BOOL isHaveCalendarDateObj = NO;
                    for (int j = 0; j < muArray.count; j ++)
                    {
                        id collectionArrayObj = muArray[j];
                        if ([collectionArrayObj isKindOfClass:[NSDictionary class]])
                        {
                            NSDictionary * dict = collectionArrayObj;
                            NSString * collectionArrayTime = dict[@"time"];
                            if ([string isEqualToString:collectionArrayTime])
                            {
                                isHaveCalendarDateObj = YES;
                            }
                        }
                    }
                    if (isHaveCalendarDateObj == NO)
                    {
                        [muArray replaceObjectAtIndex:i withObject:@{@"time":[NSString stringWithFormat:@"%lu-%.2lu-%.2ld",(unsigned long)manage.year,(unsigned long)manage.month,(long)[number integerValue]],@"date":manage.chineseCalendarDay[k]
                                                                     }];
                        break;
                    }
                }
            }
        }
        else
        {
            //依旧停留在本月
            id str = manage.calendarDate[todayPosition1];
            if ([str isKindOfClass:[NSNumber class]])
            {
                [muArray replaceObjectAtIndex:i withObject:@{@"time":[NSString stringWithFormat:@"%lu-%.2lu-%.2ld",(unsigned long)manage.year,(unsigned long)manage.month,[manage.calendarDate[todayPosition1] integerValue]],
                                                             @"date":manage.chineseCalendarDay[todayPosition1]
                                                             }];
            }
        }
    }
    [self.collectionArray addObject:muArray];
    //除本周之外的其他的数据
    NSMutableArray * muArray1 = [NSMutableArray array];
    for (int i = 0; i < 200; i ++)
    {
        todayPosition1 -- ;
        if (todayPosition1 < 0)
        {
            //跨入到上个月
            NSInteger hours = (manage.days - 1) * -24;
            NSDate * date = [NSDate dateWithTimeInterval:hours * 60 * 60 sinceDate:self.theDate];
            [manage checkThisMonthRecordFromToday:date];
            self.theDate = date;
            todayPosition1 = manage.calendarDate.count - 1;
            id obj = manage.calendarDate[todayPosition1];
            if ([obj isKindOfClass:[NSNumber class]])
            {
                [muArray1 insertObject:@{@"time":[NSString stringWithFormat:@"%lu-%.2lu-%.2ld",(unsigned long)manage.year,(unsigned long)manage.month,[manage.calendarDate[todayPosition1] integerValue]],@"date":manage.chineseCalendarDay[todayPosition1]
                                         } atIndex:0];
                if (muArray1.count == 7)
                {
                    NSMutableArray * currentArray = [NSMutableArray array];
                    [currentArray addObjectsFromArray:muArray1];
                    [self.collectionArray insertObject:currentArray atIndex:0];
                    [muArray1 removeAllObjects];
                    if (i > 190)
                    {
                        break;
                    }
                }
            }
            else
            {
                i --;
            }
        }
        else
        {
            //依旧停留在本月
            id str = manage.calendarDate[todayPosition1];
            if ([str isKindOfClass:[NSNumber class]])
            {
                [muArray1 insertObject:@{@"time":[NSString stringWithFormat:@"%lu-%.2lu-%.2ld",(unsigned long)manage.year,(unsigned long)manage.month,[manage.calendarDate[todayPosition1] integerValue]],
                                         @"date":manage.chineseCalendarDay[todayPosition1]
                                         } atIndex:0];
                if (muArray1.count == 7)
                {
                    NSMutableArray * currentArray = [NSMutableArray array];
                    [currentArray addObjectsFromArray:muArray1];
                    [self.collectionArray insertObject:currentArray atIndex:0];
                    [muArray1 removeAllObjects];
                    if (i > 190)
                    {
                        break;
                    }
                }
            }
            else
            {
                i --;
            }
        }
    }
    
    [manage checkThisMonthRecordFromToday:[NSDate date]];
    NSMutableArray * myMuarray = [NSMutableArray array];
    [myMuarray addObjectsFromArray:self.collectionArray];
    [self.collectionArray removeAllObjects];
    [myMuarray enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop)
     {
         NSArray * array = obj;
         NSMutableArray * muArray01 = [NSMutableArray array];
         [array enumerateObjectsUsingBlock:^(id  _Nonnull obj1, NSUInteger idx1, BOOL * _Nonnull stop1)
          {
              NSDictionary * dict = obj1;
              WGQAlbumDateHeaderModel * model = [[WGQAlbumDateHeaderModel alloc] initWithDict:dict];
              if ([model.dateStr isEqualToString:[NSString stringWithFormat:@"%lu-%.2lu-%.2ld",(unsigned long)manage.year,(unsigned long)manage.month,(long)[manage.calendarDate[manage.todayPosition] integerValue]]])
              {
                  model.isSelect = YES;
              }
              else
              {
                  model.isSelect = NO;
              }
              [muArray01 addObject:model];
          }];
         [self.collectionArray addObject:muArray01];
     }];
    DLog(@"%@",self.collectionArray);
}

- (void)addSubViews
{
    // 日期
    UICollectionViewFlowLayout * dateLayout = [[UICollectionViewFlowLayout alloc] init];
    dateLayout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
    dateLayout.itemSize = CGSizeMake(kScreenWidth, 72 * kScale);
    dateLayout.minimumLineSpacing = 0;
    dateLayout.minimumInteritemSpacing = 0;
    self.calendarCollectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0, self.bounds.size.width, 72 * kScale) collectionViewLayout:dateLayout];
    self.calendarCollectionView.pagingEnabled = YES;
    [self addSubview:self.calendarCollectionView];
    self.calendarCollectionView.backgroundColor = [UIColor whiteColor];
    self.calendarCollectionView.delegate = self;
    self.calendarCollectionView.dataSource = self;
    [self.calendarCollectionView registerClass:[WGQAlbumDateHeaderViewCollectionViewCell class] forCellWithReuseIdentifier:[NSString stringWithUTF8String:object_getClassName([WGQAlbumDateHeaderViewCollectionViewCell class])]];
    [self addSubview:self.calendarCollectionView];
    
    
    self.dateLabel = [[UILabel alloc] initWithFrame:CGRectMake(4 * kScale, 76 * kScale, self.bounds.size.width - 8 * kScale, 48 * kScale)];
    self.dateLabel.backgroundColor = [UIColor whiteColor];
    self.dateLabel.layer.masksToBounds = YES;
    self.dateLabel.layer.cornerRadius = 7 * kScale;
    self.dateLabel.textColor = FFColor(0x333333);
    self.dateLabel.font = [UIFont fontWithName:kMainFontFormat size:18 * kScale];
    self.dateLabel.textAlignment = NSTextAlignmentLeft;
    [self addSubview:self.dateLabel];
    
    SKCalendarManage * manage = [SKCalendarManage manage];
    [manage checkThisMonthRecordFromToday:[NSDate date]];
    self.dateLabel.text = [NSString stringWithFormat:@" %lu-%.2lu-%.2ld",(unsigned long)manage.year,(unsigned long)manage.month,(long)[manage.calendarDate[manage.todayPosition] integerValue]];
}

- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
{
    return self.collectionArray.count;
}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
    return 1;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    WGQAlbumDateHeaderViewCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:[NSString stringWithUTF8String:object_getClassName([WGQAlbumDateHeaderViewCollectionViewCell class])] forIndexPath:indexPath];
    [cell setObject:self.collectionArray[indexPath.section]];
    WeakSelf(weakSelf);
    cell.item_click_block = ^(WGQAlbumDateHeaderModel *model)
    {
        [weakSelf.collectionArray enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop)
         {
             NSMutableArray * muarray = obj;
             [muarray enumerateObjectsUsingBlock:^(id  _Nonnull obj1, NSUInteger idx1, BOOL * _Nonnull stop1)
              {
                  WGQAlbumDateHeaderModel * model = obj1;
                  model.isSelect = NO;
              }];
         }];
        [weakSelf.calendarCollectionView reloadData];
        self.dateLabel.text = [NSString stringWithFormat:@" %@",model.dateStr];
        if (self.item_click_block)
        {
            self.item_click_block(model);
        }
    };
    return cell;
}

@end




////
////  WGQAlbumDateHeaderView.m
////  meiang_edu
////
////  Created by gq w on 2018/10/2.
////  Copyright © 2018 com.meiang.meiang_edu. All rights reserved.
////
//
//#import "WGQAlbumDateHeaderView.h"
//#import "WGQAlbumDateHeaderCollectionViewCell.h"
//#import "SKCalendarManage.h"
//
//@interface WGQAlbumDateHeaderView ()<UICollectionViewDelegate,UICollectionViewDataSource>
//
//@property (nonatomic,strong) UICollectionView * calendarCollectionView;
//@property (nonatomic,strong) NSMutableArray * collectionArray;
//@property (nonatomic,strong) NSArray * weeekArray;
//@property (nonatomic,assign) NSInteger dayInWeek;
//
//@end
//
//@implementation WGQAlbumDateHeaderView
//
//- (instancetype)initWithFrame:(CGRect)frame
//{
//    if (self = [super initWithFrame:frame])
//    {
//        self.collectionArray = [NSMutableArray array];
//        self.weeekArray = @[@"日",@"一",@"二",@"三",@"四",@"五",@"六"];
//        [self takeData];
//        [self addSubViews];
//    }
//    return self;
//}
//
//- (void)takeData
//{
//    NSMutableArray * muArray = [NSMutableArray arrayWithObjects:@{},@{},@{},@{},@{},@{},@{}, nil];
//    SKCalendarManage * manage = [SKCalendarManage manage];
//    [manage checkThisMonthRecordFromToday:[NSDate date]];
//    NSInteger dayInWeek = manage.todayInMonth % 7 + manage.dayInWeek - 2;
//    self.dayInWeek = dayInWeek;
//    //先把今天加进去
//    [muArray replaceObjectAtIndex:dayInWeek withObject:@{@"time":[NSString stringWithFormat:@"%lu-%.2lu-%.2ld",(unsigned long)manage.year,(unsigned long)manage.month,(long)[manage.calendarDate[manage.todayPosition] integerValue]],
//                                                                             @"date":manage.chineseCalendarDay[manage.todayPosition]
//                                                                             }];
//    for (int i = (int)dayInWeek-1; i > -1; i --)
//    {
//        manage.todayPosition -- ;
//        id str = manage.calendarDate[i];
//        if ([str isKindOfClass:[NSNumber class]])
//        {
//            [muArray replaceObjectAtIndex:i withObject:@{@"time":[NSString stringWithFormat:@"%lu-%.2lu-%.2ld",(unsigned long)manage.year,(unsigned long)manage.month,(long)[manage.calendarDate[manage.todayPosition] integerValue]],
//                                                                      @"date":manage.chineseCalendarDay[manage.todayPosition]
//                                                                      }];
//        }
//        else
//        {
//            //跨入到上个月了
//            NSInteger hours = (manage.days - 1) * -24;
//            NSDate * date = [NSDate dateWithTimeInterval:hours * 60 * 60 sinceDate:[NSDate date]];
//            [manage checkThisMonthRecordFromToday:date];
//            DLog(@"%@",manage);
//            for (int k = (int)[manage.calendarDate count] - 1; k > 0; k --)
//            {
//                id obj = manage.calendarDate[k];
//                if ([obj isKindOfClass:[NSNumber class]])
//                {
//                    NSNumber * number = obj;
//                    NSString * string = [NSString stringWithFormat:@"%lu-%.2lu-%.2ld",(unsigned long)manage.year,(unsigned long)manage.month,(long)[number integerValue]];
//                    BOOL isHaveCalendarDateObj = NO;
//                    for (int j = 0; j < muArray.count; j ++)
//                    {
//                        id collectionArrayObj = muArray[j];
//                        if ([collectionArrayObj isKindOfClass:[NSDictionary class]])
//                        {
//                            NSDictionary * dict = collectionArrayObj;
//                            NSString * collectionArrayTime = dict[@"time"];
//                            if ([string isEqualToString:collectionArrayTime])
//                            {
//                                isHaveCalendarDateObj = YES;
//                            }
//                        }
//                    }
//                    if (isHaveCalendarDateObj == NO)
//                    {
//                        [muArray replaceObjectAtIndex:i withObject:@{@"time":[NSString stringWithFormat:@"%lu-%.2lu-%.2ld",(unsigned long)manage.year,(unsigned long)manage.month,(long)[number integerValue]],@"date":manage.chineseCalendarDay[k]
//                                                                                  }];
//                        break;
//                    }
//                }
//            }
//        }
//    }
//
//    [manage checkThisMonthRecordFromToday:[NSDate date]];
//    for (int i = (int)dayInWeek + 1; i < 7; i ++)
//    {
//        manage.todayPosition ++ ;
//        id str = manage.calendarDate[i];
//        if ([str isKindOfClass:[NSNumber class]])
//        {
//            [muArray replaceObjectAtIndex:i withObject:@{@"time":[NSString stringWithFormat:@"%lu-%.2lu-%.2ld",(unsigned long)manage.year,(unsigned long)manage.month,(long)[manage.calendarDate[manage.todayPosition] integerValue]],
//                                                                      @"date":manage.chineseCalendarDay[manage.todayPosition]
//                                                                      }];
//        }
//        else
//        {
//            //跨入到下个月
//            NSUInteger todayInMonth = manage.todayInMonth;
//            if (todayInMonth > 1)
//            {
//                todayInMonth = manage.todayInMonth - manage.dayInWeek + 2;
//            }
//            NSUInteger day = manage.days - todayInMonth;
//            NSInteger hours = (day + 1) * 24;
//            NSDate * date = [NSDate dateWithTimeInterval:hours * 60 * 60 sinceDate:[NSDate date]];
//            [manage checkThisMonthRecordFromToday:date];
//            [manage.calendarDate enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop)
//            {
//                if ([obj isKindOfClass:[NSNumber class]])
//                {
//                    NSNumber * number = obj;
//                    NSString * string = [NSString stringWithFormat:@"%lu-%.2lu-%.2ld",(unsigned long)manage.year,(unsigned long)manage.month,(long)[number integerValue]];
//                    BOOL isHaveCalendarDateObj = NO;
//                    for (int j = 0; j < muArray.count; j ++)
//                    {
//                        id collectionArrayObj = muArray[j];
//                        if ([collectionArrayObj isKindOfClass:[NSDictionary class]])
//                        {
//                            NSDictionary * dict = collectionArrayObj;
//                            NSString * collectionArrayTime = dict[@"time"];
//                            if ([string isEqualToString:collectionArrayTime])
//                            {
//                                isHaveCalendarDateObj = YES;
//                            }
//                        }
//                    }
//                    if (isHaveCalendarDateObj == NO)
//                    {
//                        [muArray replaceObjectAtIndex:i withObject:@{@"time":[NSString stringWithFormat:@"%lu-%.2lu-%.2ld",(unsigned long)manage.year,(unsigned long)manage.month,(long)[number integerValue]],@"date":manage.chineseCalendarDay[idx]}];
//                        *stop = YES;
//                    }
//                }
//            }];
//        }
//    }
//
//    [manage checkThisMonthRecordFromToday:[NSDate date]];
//    [muArray enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop)
//    {
//        NSDictionary * dict = obj;
//        WGQAlbumDateHeaderModel * model = [[WGQAlbumDateHeaderModel alloc] initWithDict:dict];
//        if ([model.topDateStr integerValue] == [manage.calendarDate[manage.todayPosition] integerValue])
//        {
//            model.isSelect = YES;
//        }
//        else
//        {
//            model.isSelect = NO;
//        }
//        [self.collectionArray addObject:model];
//    }];
//    DLog(@"%@",self.collectionArray);
//}
//
//- (void)addSubViews
//{
//    // 日期
//    CGFloat width = kScreenWidth / 7.1;
//    UICollectionViewFlowLayout * dateLayout = [[UICollectionViewFlowLayout alloc] init];
//    dateLayout.scrollDirection = UICollectionViewScrollDirectionVertical;
//    dateLayout.itemSize = CGSizeMake(width, 72 * kScale);
//    dateLayout.minimumLineSpacing = 0;
//    dateLayout.minimumInteritemSpacing = 0;
//    self.calendarCollectionView = [[UICollectionView alloc] initWithFrame:self.frame collectionViewLayout:dateLayout];
//    [self addSubview:self.calendarCollectionView];
//    self.calendarCollectionView.backgroundColor = [UIColor whiteColor];
//    self.calendarCollectionView.delegate = self;
//    self.calendarCollectionView.dataSource = self;
//    [self.calendarCollectionView registerClass:[WGQAlbumDateHeaderCollectionViewCell class] forCellWithReuseIdentifier:[NSString stringWithUTF8String:object_getClassName([WGQAlbumDateHeaderCollectionViewCell class])]];
//    [self addSubview:self.calendarCollectionView];
//}
//
//- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
//{
//    return 1;
//}
//
//- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
//{
//    return 7;
//}
//
//- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
//{
//    WGQAlbumDateHeaderCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:[NSString stringWithUTF8String:object_getClassName([WGQAlbumDateHeaderCollectionViewCell class])] forIndexPath:indexPath];
//    [cell setObject:self.collectionArray[indexPath.row]];
//    [cell setWeek:self.weeekArray[indexPath.row]];
//    return cell;
//}
//
//- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
//{
//    [self.collectionArray enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop)
//    {
//        WGQAlbumDateHeaderModel * model = obj;
//        if (idx == indexPath.row)
//        {
//            model.isSelect = YES;
//        }
//        else
//        {
//            model.isSelect = NO;
//        }
//    }];
//    [self.calendarCollectionView reloadData];
//
//    if (self.item_click_block)
//    {
//        self.item_click_block(self.collectionArray[indexPath.row]);
//    }
//}
//
//@end
